// ---------------------------------------------------------------------
//
// -- 教程界面
// -- author £
//
// ---------------------------------------------------------------------

const CommonUtil = require('CommonUtil'),
    superClass = require('AlertWindow');

cc.Class({
    extends: superClass,

    properties: {
        sp: cc.Sprite,
        txtSp: cc.Sprite,
        btnNext: cc.Node,
        sfs: {
            default: [],
            type: cc.SpriteFrame
        },
        tsfs: {
            default: [],
            type: cc.SpriteFrame
        },
    },

    ctor: function () {
        this._itr = 0;
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        CommonUtil.mysuper(superClass, this, 'onLoad');
        this.btnEnsure.node.active = false;

        this.btnNext.on('click', this.nextHandler, this);
    },

    start () {

    },

    nextHandler: function () {
        this.sp.spriteFrame = this.sfs[++this._itr];
        this.txtSp.spriteFrame = this.tsfs[this._itr];

        if (this._itr === this.sfs.length - 1) {
            this.btnNext.active = false;
            this.btnEnsure.node.active = true;
        }
    },

    // update (dt) {},
});
